package com.cloud.pole.weixin.biz;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ace.cache.annotation.Cache;
import com.ace.cache.annotation.CacheClear;
import com.cloud.pole.common.biz.BaseBiz;
import com.cloud.pole.mapper.WxUserMapper;
import com.cloud.pole.weixin.model.entity.WxApp;
import com.cloud.pole.weixin.model.entity.WxUser;

/**
 * ${DESCRIPTION}
 *
 * @author wanghaobin
 * @create 2017-06-08 16:23
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class WxUserBiz extends BaseBiz<WxUserMapper, WxUser> {
	
	@Autowired
	WxUserMapper wxUserMapper;
	
	@Cache(key="wxUser{1}")
    public WxUser selectByOpenId(String openId) {
		WxUser entity = new WxUser();
		entity.setOpenId(openId);
		return mapper.selectOne(entity);
    }
	
	@CacheClear(key="wxUser{1.openId}")
	public void updateByPrimaryKey(WxUser wxUser) {
		mapper.updateByPrimaryKey(wxUser);
	}
}
